#!/bin/tcsh -f

<beginfold id='1'>[</beginfold id='1'> a != b<endfold id='1'> ]</endfold id='1'> && echo a || echo b
# + not an operator
<beginfold id='1'>[</beginfold id='1'> 1+2 == '1+2'<endfold id='1'> ]</endfold id='1'> && echo a || echo b
<beginfold id='1'>[</beginfold id='1'> 1 != '1+2'<endfold id='1'> ]</endfold id='1'> && echo a || echo b
<beginfold id='1'>[</beginfold id='1'> a =~ b<endfold id='1'> ]</endfold id='1'> && echo a || echo b
<beginfold id='1'>[</beginfold id='1'> a !~ b<endfold id='1'> ]</endfold id='1'> && echo a || echo b

set a = 1
set b = 2

# arithmetic operators
if <beginfold id='7'>(</beginfold id='7'>$a < $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a << $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a > $b - 2<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a + 11 >> $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a <= $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a + 1 >= $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a / $b + 1<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a % $b<endfold id='7'>)</endfold id='7'> echo 1
if <beginfold id='7'>(</beginfold id='7'>$a * $b<endfold id='7'>)</endfold id='7'> echo 1

# string operators
if <beginfold id='7'>(</beginfold id='7'>$a == $b<endfold id='7'>)</endfold id='7'> echo s
if <beginfold id='7'>(</beginfold id='7'>$a != $b<endfold id='7'>)</endfold id='7'> echo s
if <beginfold id='7'>(</beginfold id='7'>$a =~ $b<endfold id='7'>)</endfold id='7'> echo s
if <beginfold id='7'>(</beginfold id='7'>$a !~ $b<endfold id='7'>)</endfold id='7'> echo s

set val = 0

<beginfold id='6'>foreach</beginfold id='6'> scen <beginfold id='3'>(</beginfold id='3'> a b <endfold id='3'>)</endfold id='3'>
  echo $scen

  if <beginfold id='7'>(</beginfold id='7'>$scen == a<endfold id='7'>)</endfold id='7'> <beginfold id='4'>then</beginfold id='4'>
    echo $scen
  else if <beginfold id='7'>(</beginfold id='7'>$scen == x<endfold id='7'>)</endfold id='7'> then
    echo x
  else
    echo $val
  <endfold id='4'>endif</endfold id='4'>
<endfold id='6'>end</endfold id='6'>
